package sv.splayer.rk.kuaifa.com.myapplication;


import android.app.Application;
import android.content.Context;


import com.danikula.videocache.HttpProxyCacheServer;



/**
 * @作者 WangYu
 * @介绍 APP 启动入口
 */
public class PlayApp extends Application {

    private static final String TAG = "PlayApp";


    private HttpProxyCacheServer proxy;
    private static PlayApp instance;

    @Override
    public void onCreate() {
        super.onCreate();
        instance = this;

    }





    public static HttpProxyCacheServer getProxy(Context context) {
        PlayApp app = (PlayApp) context.getApplicationContext();
        return app.proxy == null ? (app.proxy = app.newProxy()) : app.proxy;
    }

    private HttpProxyCacheServer newProxy() {
        return new HttpProxyCacheServer.Builder(this)
                .cacheDirectory(Utils.getVideoCacheDir(this))
                .build();
    }


    public static PlayApp getInstance() {
        return instance;
    }

}
